Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Registering Custom Attributes

You can add a custom attribute type by calling the Q3AttributeClass_Register function. If necessary, you can delete an application-defined attribute type by calling the Q3XObjectHierarchy_UnregisterClass function.

For complete details on adding custom attribute types, see "Defining Custom Attribute Types" .

Q3AttributeClass_Register

You can use the Q3AttributeClass_Register function to register an application-defined attribute type.

TQ3ObjectClass Q3AttributeClass_Register (
                     TQ3AttributeType attributeType,
                     const char *creatorName,
                     unsigned long sizeOfElement,
                     TQ3MetaHandler metaHandler);
attributeType
The type of your custom attribute.
creatorName
A pointer to a null-terminated string containing the name of the attribute's creator and the name of the type of attribute being registered.
sizeOfElement
The size of the data associated with the specified custom attribute type.
metaHandler
A pointer to an application-defined metahandler that QuickDraw 3D calls to handle the new custom attribute type.

DESCRIPTION

The Q3AttributeClass_Register function returns, as its function result, an object class reference for a new custom attribute type having a type specified by the attributeType parameter and a name specified by the creatorName parameter. The metaHandler parameter is a pointer to the metahandler for your custom attribute type. See the chapter "QuickDraw 3D Objects" for information on writing a metahandler. If Q3AttributeClass_Register cannot create a new attribute type, it returns the value NULL .

The creatorName parameter should be a pointer to null-terminated C string that contains your (or your company's) name and the name of the type of attribute you are defining. Use the colon character (:) to delimit fields within this string. The string should not contain any spaces or punctuation other than the colon character, and it cannot end with a colon. Here are some examples of valid creator names:

"MyCompany:SurfDraw:Wavelength"
"MyCompany:SurfWorks:VRModule:WaterTemperature"

The sizeOfElement parameter specifies the fixed size of the data associated with your custom attribute type. You can associate dynamically sized data with your attribute type by putting a pointer to a dynamically sized block of data into the attribute set and having your handler's copy method duplicate the data. (In this case, you would set the sizeOfElement parameter to sizeof(Ptr) .) Your handler's dispose method must also deallocate any dynamically sized blocks.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |